<?php

namespace app\model;

use think\Db;

class DriverOrder extends Common
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'driver_order';
    }

    /**
     * 类入口
     * @return DriverOrder
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }

    /**
     * 订单司机信息
     */
    public function getDriverInfo($arr_where){
        $data = Db::name($this->db_name)
            ->where($arr_where)
            ->field('driver_info.id,driver_info.real_name AS realName,driver_info.mobile,driver_pick_code.code,driver_order.box_id AS boxId,driver_info.express_id,driver_order.road_map AS roadMap')
            ->join('driver_info','driver_order.driver_id=driver_info.id','left')
            ->join('driver_pick_code','driver_order.box_id=driver_pick_code.station_order_id and driver_order.driver_id=driver_pick_code.driver_id','left')
            ->find();
        return $data;
    }
}